const http = require('http');
const urlLib = require('url');
const fs = require('fs');
const qureyString = require('querystring');

http.createServer((req, res)=>{
    // GET
    var obj = urlLib.parse(req.url, true);
    var url = obj.pathname;
    const GET = obj.query;

    // POST
    var str = '';
    req.on('data', (data) =>{
        str +=data;
    });
    req.on('end', () =>{
        const POST = qureyString.parse(str);
        console.log(url, GET, POST);
    });
  
}).listen(8080);